Automate Automations
Overview
In this lab we will review how we can run a schedule job that will syncronize users between different tools.
Keep tools in sync is vital, however that requires executing lots of repetitive tasks. With Rapid Network Automation we can automate those tasks and run them either on demand or a specific frequency.
In this lab we are synchronizing the users that can access SevOne adn RNA (imagine the customer doesn't have a centralised RADIUS server and they create accounts manually). What we do in this lab is read the users in SevOne that are part of a role, check if those users exist in RNA, and if they don't, we create those users with the credentials that we have defined. We also create a job to execute this workflow every hour to make sure the users are always synchronized.
This ways we are sure the users are synchronized and we don't need to remember to sync them manually.
Sync SevOne and RNA Users
If SevOne authentication has already been created, please skip this block of actions and continue to step 4.
- Log into SANO automation platform
- Go to Authentications
Click Create Authentication
a. Name: SevOne
b. Service: SevOne
c. Protocol: http:// (<-- important)
d. Host: 10.0.0.10
e. Username: admin
f. Password: SevOne
- Go to Authentications
Click Create Authentication
a. Name: IRNA
b. Service: Pliant
c. Protocol: http://
d. Host: 10.0.0.12
e. Username: admin
f. Password: pl1anTAut0m8tion
- Go to Workflows
Click Create Workflow
a. Name: Your Name - Sync SevOne IRNA Users
b. Layout type: Sequence
Add variables to Start
a. NMSCredentials
i. Name: NMSCredentials
ii. Type: Authentication -> SevOne
iii. Default Value: "admin/SevOne"b. IRNACredentials
i. Name: IRNACredentials
ii. Type: Authentication -> Pliant
iii. Default Value: "admin/IRNA"c. SevOneRole
i. Name: SevOneRole
ii. Type: String
iii. Default Value: "Administrators"
iv. In
v. Requiredd. IRNARole
i. Name: IRNARole
ii. Type: String
iii. Default Value: "ADMIN"
iv. In
v. Requirede. IRNAFlowRole
i. Name: IRNAFlowRole
ii. Type: String
iii. Default Value: "admin"
iv. In
v. Required
- Change to Flow View
- On the left hand side panel, search for SevOne, Click on SevOne -> REST v2 -> Roles
Select Filter Roles and drop it after the building block START
a. Change name to SevOne_Find_Role
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. roleFilter -> name: $SevOneRole
Add a new building block, SevOne -> REST v3 -> Users -> Users Users (POST)
a. Change name to SevOne_List_Users
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $NMSCredentials
ii. body -> roles -> ids: [ $SevOne_Find_Role.result.content[0].id ]
Add a new building block, Common -> ForEach
a. Change name to ForEach_SevOne_User
b. Click on the building block to open the right side panel and complete the following fields
i. list: $SevOne_List_Users.result.users
Inside the ForEach, add a new building block, Common -> Assign
a. Change name to Initiliaze_variable
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $user_found
ii. value: false
- Add a new building block, Common -> Try
Inside the Try, add a new building block, Pliant -> user-controller -> readUser
a. Change name to IRNA_Find_User
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $IRNACredentials
ii. userName: $ForEach_SevOne_User.item.username
Add a new building block, Common -> Assign
a. Change name to IRNA_User_Found
b. Click on the building block to open the right side panel and complete the following fields
i. variable: $user_found
ii. value: true
After the END of the TRY block, add a new building block, Common -> If
a. Change name to If_user_not_found
b. Click on the building block to open the right side panel and complete the following fields
i. condition: $user_found == false
On the TRUE branch of the IF, Add a new building block, Pliant -> user-controller -> createUser
a. Change name to IRNA_Create_User
b. Click on the building block to open the right side panel and complete the following fields
i. authKey: $IRNACredentials
ii. userDto
1. active: true
2. firstName: $ForEach_SevOne_User.item.firstName
3. flowRoles: [ $IRNAFlowRole ]
4. lastName: $ForEach_SevOne_User.item.lastName
5. forcePasswordChange: true
6. password: $ForEach_SevOne_User.item.username
7. provider: LOCAL
8. roles: [ $IRNARole ]
9. userName: $ForEach_SevOne_User.item.username
- Delete any other building blocks after that block (There might be an ASSIGN block that can be removed)
- Save Workflow
Create Scheduled Job
- Go to JOBS
Click Create Job
a. Name: Sync SevOne IRNA users
i. Flow: Your Name - Sync SevOne IRNA Users
ii. Seconds: 0
iii. Minutes: 0
iv. Hours: *
v. Day of Month: ?
vi. Use Default Parameters: ENABLED
vii. ENABLED